package com.li.arithmetic;

public class AverageNumber {
	public static void main(String[] args) {
		int flag=getAverageNumber(913333319);
		if(flag!=0){
			//System.out.println("is average number and the break id is "+flag);
			System.out.println("YES");
		}else{
			//System.out.println("is not average number");
			System.out.println("NO");
		}
	}
	
	public static int getAverageNumber(int number){
		char[] numberArray = String.valueOf(number).toCharArray();
		int length = numberArray.length;
		if(length==1){
			return 0;
		}
		for(int i=0;i<length;i++){
			int left=1;
			int right=1;
			int j=0;
			int m=i+1;
			while(i-j>=0){
				left=getNumber(left,numberArray[i-j]);
				j++;
			}
			while(m!=length){
				right=getNumber(right,numberArray[m]);
				m++;
			}
			if(left==right){
				return i+1;
			}
		}
		return 0;
	}
	
	public static int getNumber(int total,char number){
		return total*Integer.parseInt(number+"");
	}
}
